//
//  DcNAlbumPhotosCell.m
//  Decathlon
//
//  Created on 15-5-11.
//  Copyright (c) 2015年. All rights reserved.
//

#import "RCSAlbumPhotosCell.h"

#define kAlbumGroupCellHeight 80
#define KIconWidth 60

static NSInteger xSpace = 15;
static NSInteger bgIconWidth = 65;



@interface RCSAlbumPhotosCell()

@property (nonatomic, strong) UILabel *groupName;
@property (nonatomic, strong) UIImageView *iconImg;

@end

@implementation RCSAlbumPhotosCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self initUI];
    }
    return self;
}

-(void)initUI{
    
    self.frame = CGRectMake(0, 0, self.bounds.size.width, kAlbumGroupCellHeight);
    self.backgroundColor = [UIColor whiteColor];
    self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame] ;
    self.selectedBackgroundView.backgroundColor = RGB(238, 238, 238);
    
    UIImageView *bgIcon = [[UIImageView alloc] initWithFrame:CGRectMake(xSpace, 8, bgIconWidth, bgIconWidth)];
    bgIcon.image = [UIImage imageNamed:@"message_ablum_defult"];
    [self.contentView addSubview:bgIcon];
    
    self.iconImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KIconWidth, KIconWidth)];
    [bgIcon addSubview:_iconImg];

    self.groupName = [[UILabel alloc] initWithFrame:CGRectMake(xSpace*2 + bgIconWidth, (kAlbumGroupCellHeight - 10)/2, 200, 20)];
    self.groupName.font = [UIFont systemFontOfSize:15];
    self.groupName.textColor = RGB(78, 89, 93);
    self.groupName.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:self.groupName];
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(xSpace*2 + bgIconWidth, kAlbumGroupCellHeight-0.5, [UIScreen mainScreen].bounds.size.width - xSpace*2 + bgIconWidth, 0.5)];
    lineView.backgroundColor = RGB(223, 223, 223);
    [self.contentView addSubview:lineView];
    
    UIImageView *narrow = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - xSpace - 6, (kAlbumGroupCellHeight - 10)/2 , 6, 10)];
    narrow.image = [UIImage imageNamed:@"common_greenarrow"];
    [self.contentView addSubview:narrow];
    
}

-(void)setGroupImage:(UIImage *)image assetName:(NSString *)groupName groupAssetCount:(NSInteger)groupCount
{ 
    self.iconImg.image = image;
    self.groupName.text = [NSString stringWithFormat:@"%@   (%ld)",groupName,(long)groupCount];
}

- (void)awakeFromNib
{
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

@end
